#include "Rectemper_server.h"

void analysis_temperinfo(char *buf, char *sn, char *time, char *temper)
{
    char            *p_head, *p_end ;
    
    p_end = strstr(buf, "/") ;
    strncpy(sn , buf, (p_end - buf)) ;
    printf("sn: %s\n", sn) ;

    p_head = p_end + 1 ;        // p_head = "2019-1-23  14:17:27/15.375000C"
    p_end = strstr( (p_end + 1), "/") ; // p_end= "/15.375000C"
    strncpy(time, p_head, (p_end-p_head)); 
    printf("time: %s\n", time) ;

    p_head = p_end + 1 ; // p_head ="15.375000C"
    p_end = strstr(p_end, "C") ;
    strncpy(temper, p_head, (p_end - p_head)) ;
    printf("Temperature: %s\n", temper) ;
                    
}
